<script setup>
import { computed } from 'vue';
import { reactive } from 'vue';
import{ref} from 'vue';
        let list=reactive([{'speak':'我是菜鸟','time':'2024-04-01 14:56'}]);
        let newTime=ref('');
        let content=ref('');
        let time=ref(new Date().toLocaleDateString()+ new Date().toLocaleTimeString())
        let fn=()=>{
            let one=content.value;
            list.push({'speak':one,'time':time});
            let two=list[list.length-1].time
            console.log(list[list.length-1].time);
            content.value='';
            newTime.value=two
        }
        

</script>

<template>
   <div>
      <div class="top">
          <input type="button" value="评论" @click="fn">
          <textarea name="text" cols="30" rows="10" placeholder="请输入内容" v-model="content"></textarea>
      </div>
      <div class="middle" >
          最新回复时间：{{newTime}}
      </div>
      <div class="cheat">
        <div class="bottom" v-for="item in list" :key="item.id">
          <div class="img" ></div>
          <div class="speak">{{ item.speak }}</div>
          <div class="time">{{ item.time }}</div>
      </div>
      </div>
      
  </div>
    
</template>